import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';

class SettingView extends StatefulWidget {
  final String string;
  final String? valueStr;
  final Function onConfirm;

  const SettingView({Key? key, required this.string, this.valueStr,required this.onConfirm,})
      : super(key: key);

  @override
  _SettingViewState createState() => _SettingViewState();
}

class _SettingViewState extends State<SettingView> {

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        color: Colors.white,
        height: 55,
        padding: EdgeInsets.only(left: 15, right: 15),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text(widget.string,
                    style: TextStyle(fontSize: 15, color: AppColors.black)),
                Row(
                  children: [
                    Text(widget.string == '清理缓存' ? '${widget.valueStr}' : '',
                        style: TextStyle(fontSize: 15, color: Colors.black54)),
                    Image.asset(
                      'assets/images/common/arrow_white_right@2x.png',
                      width: 20,
                      height: 20,
                      color: Colors.black45,
                    )
                  ],
                ),
              ],
            ),
            Container(
              color: AppColors.line,
              height: 1,
            )
          ],
        ),
      ),
      onTap: () {
        widget.onConfirm(widget.string);
      },
    );
  }
}
